Skip to content

#2490 Added version and profile information to GLData,#3280

Draft
FluBBaOfWard wants to merge 1 commit intoeclipse-platform:masterfrom
FluBBaOfWard:Add_GL3_support_for_MacOS
Draft

#2490 Added version and profile information to GLData,#3280
FluBBaOfWard wants to merge 1 commit intoeclipse-platform:masterfrom
FluBBaOfWard:Add_GL3_support_for_MacOS

Conversation

@FluBBaOfWard
Copy link
Copy Markdown

MacOS uses this to request a specific GL version.

…, MacOS uses this to request a specific GL version.
@FluBBaOfWard FluBBaOfWard marked this pull request as draft May 4, 2026 12:23
Comment on lines +90 to +109
if (data.profile == Profile.CORE) {
attrib[pos++] = NSOpenGLPFAOpenGLProfile;
attrib[pos++] = NSOpenGLProfileVersion3_2Core;
}
if (data.profile == Profile.COMPATIBILITY) {
attrib[pos++] = NSOpenGLPFAOpenGLProfile;
attrib[pos++] = NSOpenGLProfileVersionLegacy;
} else {
if (data.majorVersion >= 4) {
attrib[pos++] = NSOpenGLPFAOpenGLProfile;
attrib[pos++] = NSOpenGLProfileVersion4_1Core;
} else if (data.majorVersion >= 3) {
attrib[pos++] = NSOpenGLPFAOpenGLProfile;
attrib[pos++] = NSOpenGLProfileVersion3_2Core;
} else {
attrib[pos++] = NSOpenGLPFAOpenGLProfile;
attrib[pos++] = NSOpenGLProfileVersionLegacy;
}
}

Copy link
Copy Markdown

@ferdnyc ferdnyc May 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If data.profile == Profile.CORE, you're going to end up adding two profile attribute pairs to the array.

  1. First on lines 91-92, you'll add this pair:
    • (NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core)
  2. Then when the test at line 94 fails you'll take the else path at line 97, and depending what data.majorVersion contains, you'll also add one of these three pairs:
    • (NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion4_1Core)
    • (NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core) (again!)
    • (NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersionLegacy)

That doesn't seem like what you'd want. Should line 94 be an else if? Or does the logic here need to be more robust? (The code starting at line 223 makes it seem like Profile.CORE should only be used with numbered versions, and Profile.COMPATIBILITY should be 1:1 with VersionLegacy, but that's not at all what the code here does.)

And then the comments even farther down claim that Profile is only valid if the major+minor version is at least 3.0. Meaning Profile.COMPATIBILITY is never actually a valid profile, because it's used when the version is "Legacy" (which seems implicitly to mean "less than 3.0")?

@ferdnyc
Copy link
Copy Markdown

ferdnyc commented May 7, 2026

The Qt6 implementation of this is QOpenGLVersionProfile, which states that:

  1. OpenGL 3.2 is the minimum required for profile support
  2. A "legacy version" is an OpenGL version 3.1 or less
  3. The OpenGLContextProfile is always QSurfaceFormat::NoProfile with legacy OpenGL versions
  4. Code running on OpenGL versions 3.2 or greater can "choose between a restricted core profile, and a compatibility profile which might contain deprecated support functionality." (QSurfaceFormat::CoreProfile vs. QSurfaceFormat::CompatibilityProfile)

So, in their model "Legacy" doesn't correspond to "Compatibility profile" at all, in fact it means that profiles are unsupported so neither Core nor Compatibility can be selected, the profile is "No profile".

With versions >= 3.2, either the Core or Compatibility profile can be selected, though Apple's (deprecated) NSOpenGLProfile* constants don't appear to have ever had any support for selecting a compatibility profile. (Or if they do, I can't find it in their incredibly-hard-to-parse docs with all of the deprecated feature names struck through for maximum reading difficulty.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants